cmake_minimum_required(VERSION 3.16)


project(back_tracer_mingw LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
    set(PRJ_SOURCES  main_linux.cpp crash_dump_linux.h)
    add_executable(back_tracer ${PRJ_SOURCES} )

    target_link_libraries(back_tracer PRIVATE
        backtrace
    )

elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
    if (MSVC)
        set(PRJ_SOURCES  main_msvc.cpp crash_dump_msvc.h)
        add_executable(back_tracer ${PRJ_SOURCES} )

        target_link_libraries(back_tracer PRIVATE
            backtrace
        )

    else ()
        set(PRJ_SOURCES  main_mingw.cpp crash_dump_mingw.h)
        add_executable(back_tracer ${PRJ_SOURCES} )

        target_link_libraries(back_tracer PRIVATE
            backtrace
        )
    endif ()

endif ()
